package com.car.web.controller.interfaceController;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.log4j.Logger;
import org.json.JSONArray;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.car.bean.GridObj;
import com.car.bean.PageObj;
import com.car.dal.dao.department.TgDepartmentDao;
import com.car.dal.dao.ndzjypb.NdzjypbDao;
import com.car.dal.dao.ndzjypb.NdzwpjDao;
import com.car.dal.dao.office.TgOfficeDao;
import com.car.dal.dao.task.TgTaskDao;
import com.car.dal.dao.user.UserDao;
import com.car.dal.dao.user.UserinfoDao;
import com.car.dal.dao.usergroup.TgUsergroupDao;
import com.car.dal.dao.work.TgworkDao;
import com.car.dal.object.Content;
import com.car.dal.object.Images;
import com.car.dal.object.TgDepartment;
import com.car.dal.object.TgNdzjypb;
import com.car.dal.object.TgNdzwpj;
import com.car.dal.object.TgOffice;
import com.car.dal.object.TgPower;
import com.car.dal.object.TgTask;
import com.car.dal.object.TgUser;
import com.car.dal.object.TgUsergroup;
import com.car.dal.object.TgUserinfo;
import com.car.dal.object.TgWork;
import com.car.exception.BaseException;
import com.car.service.ndzjypb.Ndzjypbservice;
import com.car.service.ndzjypb.Ndzwpjservice;
import com.car.service.task.TaskService;
import com.car.util.DateUtil;
import com.car.util.JsonExecutor;
import com.car.util.JsonExecutor.JsonBiz;
import com.car.util.JsonValidator;
import com.car.util.Page;
import com.car.util.PageUtil;
import com.car.util.Result;
import com.car.util.ResultSupport;
import com.car.util.StringUtil;
import com.car.util.UserUtil;
import com.car.util.WebExecutor;
import com.car.util.WebExecutor.Biz;
import com.car.web.controller.base.BaseController;
import com.car.web.controller.base.BaseVo;
import com.google.gson.Gson;

/**
 * 登录控制
 * 
 * @author Administrator
 * 
 */
@Controller
@RequestMapping("/oa")
public class WorkInteController extends BaseController {

	private static final Logger logger = Logger
			.getLogger(WorkInteController.class);
    @Resource
    private UserDao userDao;
    @Resource
	private TgworkDao workDao;
    @Resource
    private TgUsergroupDao tgUsergroupDao;
    @Resource
    private TgDepartmentDao tgDepartmentDao;
    @Resource
    private UserinfoDao userinfoDao;
    @Resource
    private TgOfficeDao tgOfficeDao;
    @Resource
    private TaskService taskSerice;
    @Resource
    private TgTaskDao taskDao;
    @Resource
    private Ndzjypbservice ndzjypbservice;
    @Resource
	private NdzjypbDao ndzjypbDao;
    @Resource
    private Ndzwpjservice ndzwpjservice;
    @Resource
	private NdzwpjDao ndzwpjDao;
    
    
 	//查出今日的工作信息
    @RequestMapping(value = "/work_today")
	public ModelAndView login(ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, final HttpServletResponse response)
			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
			public Result process() {
				Result result = new ResultSupport(true);
				try { 
					String time = "";
					String date = request.getParameter("date");
					String login_name = request.getParameter("login_name");
					
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					DecimalFormat df = new DecimalFormat("######0.0");
					SimpleDateFormat sd = new SimpleDateFormat("HH:mm");
					
					TgWork  work = new TgWork();
					
					if(date!=null && !"".equals(date)){
						time=date;
						result.setDefaultModel("date", time);
					}else{
						
						time = sdf.format(DateUtil.getToDay());
					}
					String week = DateUtil.convWeek(DateUtil.getDateWeek(sdf.parse(time)));
					result.setDefaultModel("time", time);
					result.setDefaultModel("week", week);
					List<TgWork> list = workDao.getTgWorkBytime(login_name ,time);
					if(list!=null && list.size()>0){
						work = list.get(0);
						
						//日志内容
						if(work.getContent()!=null && !"".equals(work.getContent())){
							JsonValidator json = new JsonValidator();
							Boolean flag = json.validate(work.getContent());
							String ObjContent = "";
							if(flag){
								ObjContent = work.getContent();
							}else{
								byte[] bytes=StringUtil.hexDecode(work.getContent());
								ObjContent = new String(bytes, "UTF-8");
							}
							JSONArray array = new JSONArray(ObjContent);
							List<Content> contentList = new ArrayList<Content>();
							Gson gson = new Gson();
							for(int i=0;i<array.length();i++){
								Content content = gson.fromJson(array.get(i).toString(), Content.class);
								contentList.add(content);
							}
							if(contentList!=null && contentList.size()>0){
								for(Content content:contentList){
									if(content.getTime()!=null){
										String[] time2 = content.getTime().split("-");
										if(time2!=null){
											Date start = sd.parse(time2[0]);
											Date end = sd.parse(time2[1]);
											Long stime = end.getTime()-start.getTime();
											String count = df.format((double)stime/1000/60/60);
											content.setCount(count);
										}
									}
								}
							}
							result.setDefaultModel("contentList", contentList);
						}
						
						//日志图片
						if(work.getImages()!=null && !"".equals(work.getImages()) && !"图片".equals(work.getImages())){
							String img = work.getImages().replace("图片,", "");
							String[] imgs = img.split(",");
							result.setDefaultModel("imgs", imgs);
						}
						
						result.setDefaultModel("work", work);
					}
				} catch (Exception e) {
					e.printStackTrace();
				}
				return result;
			}
		});
		return new ModelAndView("", modelMap);
	}
    
    
    //添加工作日志
    @RequestMapping(value = "/addWork")
    public ModelAndView addWork (ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, HttpServletResponse response)
					throws BaseException {
		modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
			public Result process() {
				Result result = new ResultSupport(true);
				
				String time = null;
				String date = request.getParameter("date");
				String content = request.getParameter("content");
				String images = request.getParameter("images");
				String login_name = request.getParameter("login_name");
				
				TgWork work = new TgWork();
				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
				
				Date t = null;
				if(date!=null && !"".equals(date)){
					try {
						t = sdf.parse(date);
						time = sdf.format(t);
					} catch (Exception e) {
						e.printStackTrace();
					}
				}else{
					try {
						t = DateUtil.getToDay();
						time = sdf.format(DateUtil.getToDay());
					} catch (Exception e) {
						e.printStackTrace();
					}
				}
				List<TgWork> list = workDao.getTgWorkBytime(login_name ,time);
				
				if(list!=null && list.size()>0){
					work.setId(list.get(0).getId());
					work.setUsername(login_name);
					work.setContent(content);
					work.setImages("图片"+images);
					work.setMdate(new Date().getTime()/1000);
					workDao.update(work);
					result.setDefaultModel("msg", "1");
				}else{
					work.setUsername(login_name);
					work.setContent(content);
					work.setImages("图片"+images);
					work.setCreatedate(t.getTime()/1000);
					work.setMdate(new Date().getTime()/1000);
					workDao.insert(work);
					result.setDefaultModel("msg", "2");
				}
				return result;
			}
		});
	
		return new ModelAndView("", modelMap);
	}
    
    //查看工作历史记录
    @RequestMapping(value = "/work_history")
	public ModelAndView work_history(ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, final HttpServletResponse response)
			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
			public Result process() {
				Result result = new ResultSupport(true);
				try {
					String login_name = request.getParameter("login_name");
					
					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
					
					//近三天时间
					Date today = DateUtil.getToDay();
					Date BeforeDay = DateUtil.getBeforeDay();
					Date BeforetwoDay = DateUtil.getBeforetwoDay();
					
					TgWork  work = new TgWork();
					work.setUsername(login_name);
					
					Integer currPage = 1 ;
					if (vo.getCurrPage()!=null&&!"".equals(vo.getCurrPage())) {
						currPage=vo.getCurrPage();
					}
					
					Integer total = workDao.getWorkByTypeCount(work);
					Page page = PageUtil.createPage(8, currPage, total);
					List<TgWork> list = workDao.getWorkByType(work,page);
					if(list!=null && list.size()>0){
						for(TgWork tgWork:list){
							tgWork.setCreateTime(sdf.format(new Date(tgWork.getCreatedate()*1000)));
						}
					}
					
					result.setDefaultModel("list", list);
					result.setDefaultModel("page", page);
					
					result.setDefaultModel("today", sdf.format(today));
					result.setDefaultModel("BeforeDay", sdf.format(BeforeDay));
					result.setDefaultModel("BeforetwoDay", sdf.format(BeforetwoDay));
				} catch (Exception e) {
					e.printStackTrace();
				}
				return result;
			}
		});
		return new ModelAndView("", modelMap);
	}
    
    //工作详情
    @RequestMapping(value = "/work_view")
   	public ModelAndView work_view(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				try {
   					String time = request.getParameter("time");
   					String username = request.getParameter("username");
   					SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   					DecimalFormat df = new DecimalFormat("######0.0");
					SimpleDateFormat sd = new SimpleDateFormat("HH:mm");
					
   					if(time!=null && !"".equals(time)){
   						String week = DateUtil.convWeek(DateUtil.getDateWeek(sdf.parse(time)));
   						result.setDefaultModel("time", time);
   						result.setDefaultModel("week", week);
   					}
   					
	   				if(username!=null && !"".equals(username)){
	   					List<TgWork> list = workDao.getTgWorkBytime(username ,time);
	   					
	   					if(list!=null && list.size()>0){
	   						Gson gson = new Gson();
							TgWork work = list.get(0);
							work.setCreateTime(time);
							
							if(work.getContent()!=null && !"".equals(work.getContent())){
								JsonValidator json = new JsonValidator();
								Boolean flag = json.validate(work.getContent());
								String ObjContent = "";
								if(flag){
									ObjContent = work.getContent();
								}else{
									byte[] bytes=StringUtil.hexDecode(work.getContent());
									ObjContent = new String(bytes, "UTF-8");
									
								}
								JSONArray array = new JSONArray(ObjContent);
								List<Content> contentList = new ArrayList<Content>();
								for(int i=0;i<array.length();i++){
									Content content = gson.fromJson(array.get(i).toString(), Content.class);
									contentList.add(content);
								}
								if(contentList!=null && contentList.size()>0){
									for(Content content:contentList){
										if(content.getTime()!=null){
											String[] time2 = content.getTime().split("-");
											if(time2!=null){
												Date start = sd.parse(time2[0]);
												Date end = sd.parse(time2[1]);
												Long stime = end.getTime()-start.getTime();
												String count = df.format((double)stime/1000/60/60);
												content.setCount(count);
											}
										}
									}
								}
								result.setDefaultModel("contentList", contentList);
							}
							
							//图片处理
							if(work.getImages()!=null && !"".equals(work.getImages())){
								List<Images> imgList = new ArrayList<Images>();
								boolean flag = StringUtil.getHanzi(work.getImages());
								
								if(flag){
									String[] img = (work.getImages().replace("图片,","")).split(",");
									for(int i=0;i<img.length;i++){
										Images images = new Images();
										images.setUrl(img[i]);
										imgList.add(images);
									}
								}else{
									byte[] bytesImg=StringUtil.hexDecode(work.getImages());
									String images = new String(bytesImg, "UTF-8");
									String[] img = images.split("\\|\\|\\|");
									
									for(int i=0;i<img.length;i++){
										Images image = gson.fromJson(img[i], Images.class);
										imgList.add(image);
									}
									result.setDefaultModel("imgList", imgList);
								}
							}
							
							result.setDefaultModel("work", work);
						}
   					}
   				} catch (Exception e) {
					e.printStackTrace();
				}
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
  
    //每日、每周任务完成情况
    @RequestMapping(value = "/task_list")
   	public ModelAndView task_list(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String type = request.getParameter("type");
   				String username = request.getParameter("username");
   				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
   				
   				TgTask task = new TgTask();
   				
   				if(type!=null && !"".equals(type)){
   					task.setType(Integer.valueOf(type));
   				}else{
   					return result;
   				}
   				
   				if(username!=null && !"".equals(username)){
   					task.setUsername(username);
   				}
   	   				
   				Integer currPage = vo.getCurrPage() == null ? 1 : vo.getCurrPage();

				Integer total = taskSerice.getTaskCountByType(task);
				Page page = PageUtil.createPage(8, currPage, total);
				List<TgTask> list = taskSerice.getTaskByType(task, page);
				
				if(type.equals("1")){
					TgTask task1 = new TgTask();
					if(username!=null && !"".equals(username)){
						task1.setUsername(username);
	   				}
					task1.setDate(sdf.format(new Date()));
					task1.setType(Integer.valueOf(type));
					List<TgTask> tlist1 = taskDao.getTaskByType2(task1);
					if(tlist1!=null && tlist1.size()>0){
						task1 = tlist1.get(0);
						task1.setIs_has("1");
					}else{
						task1.setIs_has("0");
					}
					
					
					TgTask task2 = new TgTask();
					if(username!=null && !"".equals(username)){
						task2.setUsername(username);
	   				}
					task2.setDate(sdf.format(DateUtil.getBeforeDay()));
					task2.setType(Integer.valueOf(type));
					List<TgTask> tlist2 = taskDao.getTaskByType2(task2);
					if(tlist2!=null && tlist2.size()>0){
						task2 = tlist2.get(0);
						task2.setIs_has("1");
					}else{
						task2.setIs_has("0");
					}
					
					result.setDefaultModel("task1", task1);
					result.setDefaultModel("task2", task2);
					result.setDefaultModel("date", sdf.format(new Date()));
					result.setDefaultModel("beforeDate", sdf.format(DateUtil.getBeforeDay()));
				}else if(type.equals("2")){
					List<String> dlist = DateUtil.printWeekdays(sdf.format(new Date()));
					if(dlist!=null && dlist.size()>0){
						String date = dlist.get(0)+"到"+dlist.get(dlist.size()-1);
						result.setDefaultModel("date", date);
						
						TgTask task1 = new TgTask();
						if(username!=null && !"".equals(username)){
							task1.setUsername(username);
		   				}
						task1.setStratTime(dlist.get(0));
						task1.setEndTime(dlist.get(dlist.size()-1));
						task1.setType(Integer.valueOf(type));
						List<TgTask> tlist1 = taskDao.getTaskByType2(task1);
						if(tlist1!=null && tlist1.size()>0){
							task1 = tlist1.get(0);
							task1.setIs_has("1");
						}else{
							task1.setIs_has("0");
						}
						result.setDefaultModel("task1", task1);
					}
					
					if(list!=null && list.size()>0){
						for(TgTask t:list){
							dlist = DateUtil.printWeekdays(t.getDate());
							t.setDate(dlist.get(0)+"到"+dlist.get(dlist.size()-1));
						}
					}
				}
				
				result.setDefaultModel("list", list);
				result.setDefaultModel("page", page);
				result.setDefaultModel("type", type);
				
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //添加每日、每周任务完成情况
    @RequestMapping(value = "/add_task")
   	public ModelAndView add_task(ModelMap modelMap, final BaseVo vo,
   			final HttpServletRequest request, final HttpServletResponse response)
   			throws Exception {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
   			public Result process() {
   				Result result = new ResultSupport(true);
   				String id = request.getParameter("id");
   				String type = request.getParameter("type");
   				String date = request.getParameter("date");
   				String matter1 = request.getParameter("matter1");
   				String matter2 = request.getParameter("matter2");
   				String matter3 = request.getParameter("matter3");
   				String username = request.getParameter("username");
   				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
				
   				TgTask task = new TgTask();
   				task.setUsername(username);
   				if(type!=null && !"".equals(type)){
   					task.setType(Integer.valueOf(type));
   				}else{
   					return result;
   				}
   				task.setMatter1(matter1);
   				task.setMatter2(matter2);
   				task.setMatter3(matter3);
   				if(id!=null && !"".equals(id)){
   					task.setId(Long.valueOf(id));
   					taskDao.update(task);
   					result.setDefaultModel("msg", "1");
   				}else{
   					if(date!=null && !"".equals(date)){
   						task.setDate(date);
   					}else{
   						task.setDate(sdf.format(new Date()));
   					}
   	   				task.setCreate_time(new Date());
   	   				taskDao.insert(task);
   	   				result.setDefaultModel("msg", "1");
   				}
   				return result;
   			}
   		});
   		return new ModelAndView("", modelMap);
   	}
    
    //保存竞思年度总结与评比
    @RequestMapping(value = "/save_ndzjypbs")
    public ModelAndView save_ndzjypbs(ModelMap modelMap, final BaseVo vo,
			final HttpServletRequest request, HttpServletResponse response)
					throws BaseException {
		modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
			public Result process() {
				Result result = new ResultSupport(true);
				
				TgNdzjypb ndzjypb = new TgNdzjypb();
   				ndzjypb.setAdd_username(request.getParameter("add_username"));
   				ndzjypb.setCenter(request.getParameter("center"));
   				if(ndzjypbDao.countEqual(ndzjypb) > 0){
   					result.setDefaultModel("flag", "2");
   					return result;
   				}
   				ndzjypb.setDepartment(request.getParameter("department"));
   				ndzjypb.setPost(request.getParameter("post"));
   				ndzjypb.setWorking_life(request.getParameter("working_life"));
   				ndzjypb.setA(Integer.valueOf(request.getParameter("a")));
   				ndzjypb.setB(Integer.valueOf(request.getParameter("b")));
   				ndzjypb.setC(Integer.valueOf(request.getParameter("c")));
   				ndzjypb.setD(Integer.valueOf(request.getParameter("d")));
   				ndzjypb.setE(Integer.valueOf(request.getParameter("e")));
   				ndzjypb.setF(Integer.valueOf(request.getParameter("f")));
   				ndzjypb.setG(Integer.valueOf(request.getParameter("g")));
   				ndzjypb.setH(Integer.valueOf(request.getParameter("h")));
   				ndzjypb.setI(Integer.valueOf(request.getParameter("i")));
   				ndzjypb.setJ(Integer.valueOf(request.getParameter("j")));
   				ndzjypb.setK(Integer.valueOf(request.getParameter("k")));
   				ndzjypb.setL(Integer.valueOf(request.getParameter("l")));
   				ndzjypb.setM(Integer.valueOf(request.getParameter("m")));
   				ndzjypb.setN(Integer.valueOf(request.getParameter("n")));
   				ndzjypb.setO(Integer.valueOf(request.getParameter("o")));
   				ndzjypb.setP(Integer.valueOf(request.getParameter("p")));
   				ndzjypb.setQ(Integer.valueOf(request.getParameter("q")));
   				ndzjypb.setR(Integer.valueOf(request.getParameter("r")));
   				ndzjypb.setS(Integer.valueOf(request.getParameter("s")));
   				ndzjypb.setT(Integer.valueOf(request.getParameter("t")));
   				ndzjypb.setU(Integer.valueOf(request.getParameter("u")));
   				ndzjypb.setV(Integer.valueOf(request.getParameter("v")));
   				ndzjypb.setW(Integer.valueOf(request.getParameter("w")));
   				ndzjypb.setX(Integer.valueOf(request.getParameter("x")));
   				ndzjypb.setY(Integer.valueOf(request.getParameter("y")));
   				ndzjypb.setZ(Integer.valueOf(request.getParameter("z")));
   				ndzjypb.setA1(Integer.valueOf(request.getParameter("a1")));
   				ndzjypb.setB1(Integer.valueOf(request.getParameter("b1")));
   				ndzjypb.setC1(Integer.valueOf(request.getParameter("c1")));
   				ndzjypb.setD1(Integer.valueOf(request.getParameter("d1")));
   				ndzjypb.setE1(Integer.valueOf(request.getParameter("e1")));
   				ndzjypb.setF1(Integer.valueOf(request.getParameter("f1")));
   				ndzjypb.setG1(Integer.valueOf(request.getParameter("g1")));
   				ndzjypb.setH1(Integer.valueOf(request.getParameter("h1")));
   				ndzjypb.setI1(Integer.valueOf(request.getParameter("i1")));
   				ndzjypb.setJ1(Integer.valueOf(request.getParameter("j1")));
   				ndzjypb.setK1(Integer.valueOf(request.getParameter("k1")));
   				ndzjypb.setL1(Integer.valueOf(request.getParameter("l1")));
   				ndzjypb.setM1(Integer.valueOf(request.getParameter("m1")));
   				ndzjypb.setN1(Integer.valueOf(request.getParameter("n1")));
   				ndzjypb.setO1(Integer.valueOf(request.getParameter("o1")));
   				ndzjypb.setP1(request.getParameter("p1"));
   				ndzjypb.setCreat_time(new Date());
   				
   				ndzjypbservice.insert(ndzjypb);
				result.setDefaultModel("flag", "1");
				return result;
			}
		});
	
		return new ModelAndView("", modelMap);
	}
    
    //保存竞思年度总结与评比
    @RequestMapping(value = "/save_ndzwpjs")
    public ModelAndView save_ndzwpjs(ModelMap modelMap, final BaseVo vo,
    		final HttpServletRequest request, HttpServletResponse response)
    				throws BaseException {
    	modelMap = JsonExecutor.execute(logger, vo, new JsonBiz() {
    		public Result process() {
    			Result result = new ResultSupport(true);
    			TgNdzwpj tgNdzwpj = new TgNdzwpj();
   				tgNdzwpj.setAdd_username(request.getParameter("add_username"));
   				tgNdzwpj.setCenter(request.getParameter("center"));
   				tgNdzwpj.setPj_name(request.getParameter("pj_name"));
   				if(ndzwpjDao.countEqual(tgNdzwpj) > 0){
   					result.setDefaultModel("flag", "2");
   					return result;
   				}
   				tgNdzwpj.setA(request.getParameter("a"));tgNdzwpj.setB(request.getParameter("b"));
   				tgNdzwpj.setC(request.getParameter("c"));tgNdzwpj.setD(request.getParameter("d"));
   				tgNdzwpj.setE(request.getParameter("e"));tgNdzwpj.setF(request.getParameter("f"));
   				tgNdzwpj.setG(request.getParameter("g"));tgNdzwpj.setH(request.getParameter("h"));
   				tgNdzwpj.setI(request.getParameter("i"));tgNdzwpj.setJ(request.getParameter("j"));
   				tgNdzwpj.setK(request.getParameter("k"));tgNdzwpj.setL(request.getParameter("l"));
   				tgNdzwpj.setM(request.getParameter("m"));tgNdzwpj.setN(request.getParameter("n"));
   				tgNdzwpj.setO(request.getParameter("o"));tgNdzwpj.setP(request.getParameter("p"));
   				tgNdzwpj.setQ(request.getParameter("q"));tgNdzwpj.setR(request.getParameter("r"));
   				tgNdzwpj.setS(request.getParameter("s"));tgNdzwpj.setT(request.getParameter("t"));
   				tgNdzwpj.setCreate_time(new Date());
   				ndzwpjservice.insert(tgNdzwpj);
				result.setDefaultModel("flag", "1");
    			return result;
    		}
    	});
    	
    	return new ModelAndView("", modelMap);
    }
    
    
}
